<!DOCTYPE html>
<html>
<head>
    <title>手机端后台</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="Write an awesome description for your new site here">
    <link rel="stylesheet" href="css/weui.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css">
    <link rel="stylesheet" href="css/demos.css">
    <style type="text/css">
        .placeholder {
            margin: 5px;
            padding: 0 10px;
            background-color: #808080;
            height: 2.3em;
            line-height: 2.3em;
            text-align: center;
            color: #cfcfcf;
        }
    </style>
</head>

<body ontouchstart>
<div class="weui-flex">
    <div class="weui-flex__item">
        <div class="placeholder">首页</div>
    </div>
</div>
<header class='demos-header' style="padding-top: 70px;padding-bottom: 70px;">
    <h1 class="demos-title"> <?php if (isset($studentInfo['studentNumber'])) {
            echo $studentInfo['studentNumber'];
        } else { ?>
            用户名
        <?php } ?></h1>
</header>

<div class="weui-grids">
    <a href="./room.php" class="weui-grid js_grid">
        <div class="weui-grid__icon">
            <img src="images/icon_nav_button.png" alt="">
        </div>
        <p class="weui-grid__label">
            选课
        </p>
    </a>
    <a href="./inquire.php" class="weui-grid js_grid">
        <div class="weui-grid__icon">
            <img src="images/icon_nav_cell.png" alt="">
        </div>
        <p class="weui-grid__label">
            查询
        </p>
    </a>
    <a href="message.php" class="weui-grid js_grid">
        <span class="weui-badge" style="position: absolute;top:1em;right: 2em;visibility:hidden;"
              id="messageCount">0</span>
        <div class="weui-grid__icon">
            <img src="images/icon_nav_cell.png" alt="">
        </div>
        <p class="weui-grid__label">
            消息
        </p>
    </a>
    <a href="modifyPassword.php" class="weui-grid js_grid">
        <div class="weui-grid__icon">
            <img src="images/icon_nav_cell.png" alt="">
        </div>
        <p class="weui-grid__label">
            修改密码
        </p>
    </a>
    <a href="../studentPhoneLogin/loginPage.html" class="weui-grid js_grid">
        <div class="weui-grid__icon">
            <img src="images/icon_nav_cell.png" alt="">
        </div>
        <p class="weui-grid__label">
            退出
        </p>
    </a>
</div>
<div class="weui-footer weui-footer_fixed-bottom">
    <p class="weui-footer__links">
        <a href="javascript:void(0)" class="weui-footer__link">中国计量大学</a>
    </p>
    <p class="weui-footer__text">Copyright © 2018.6.29</p>
</div>
<script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/swiper.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/city-picker.min.js"></script>
<script src="js/fastclick.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
        getMessage();
    });
</script>
<script>
    function getMessage() {
        var url = "./getmessage.php";
        $.get(url, function (data, status) {
            console.log("Received data:", data.messageCount);
            if(data.messageCount > 0)
            {
                document.getElementById("messageCount").innerHTML = data.messageCount;
                document.getElementById('messageCount').style.visibility = 'visible';
            }
        });
    }

    //setInterval("getMessage()", 3000);
</script>
</body>
</html>
